package cn.johnyu.order.service;

import cn.johnyu.order.client.AccountClient;
import cn.johnyu.order.client.ProductClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;

@Service
public class OrderServiceImpl implements OrderService{
//    @Autowired
//    private RestTemplate restTemplate;
    @Autowired
    private ProductClient productClient;
    @Autowired
    private AccountClient accountClient;

    @Override
    public Map<String, String> info() {
        HashMap<String, String> map = new HashMap<>();
        String info1 = productClient.info();
        String info2 = accountClient.info();
//        String info1 = restTemplate
//                .getForObject("http://product-svc/info", String.class);
        map.put("product",info1);
        map.put("account",info2);
        return map;
    }
}
